interface AttentListState {
  avator: string;
  nickname: string;
  title: string;
  desc: string;
  url: string;
  id: string;
}

interface AttentState {
  attentList: AttentListState[];
}

const initState: AttentState = {
  attentList: [],
};


const ADD_ADDENT_LIST = 'ADD_ADDENT_LIST'

interface AddAttentList {
	type: typeof ADD_ADDENT_LIST
	payload: AttentListState
}

export function addAttentListAction(payload: AttentListState):  AddAttentList{
	return { type:  ADD_ADDENT_LIST, payload}
}

type AttentAction = AddAttentList

export default (state = initState, action: AttentAction) => {
	switch(action.type) {
		case ADD_ADDENT_LIST:
			return {
				...state,
				attentList: [action.payload, ...state.attentList]
			};
		default : return state
	}
};
